package cn.flying.base.common.exception;


import cn.flying.base.common.enums.BaseEnumInfo;

/**
 * @description: 公共异常
 * @author: lvyong
 * @date: 2022年04月02日 21:51
 * @version: 1.0
 */
public class FlyingException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    private String code;
    private String message;

    public FlyingException() {
        super();
    }

    public FlyingException(BaseEnumInfo enumInfo) {
        super(enumInfo.getMessage());
        this.code = enumInfo.getCode();
        this.message = enumInfo.getMessage();
    }

    public FlyingException(BaseEnumInfo enumInfo, Throwable cause) {
        super(enumInfo.getMessage(), cause);
        this.code = enumInfo.getCode();
        this.message = enumInfo.getMessage();
    }

    protected FlyingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public FlyingException(String message) {
        super(message);
        this.message = message;
    }

    public FlyingException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public FlyingException(String code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
